﻿<?php
	session_start();
	require_once("../connectMysql/connetMysql.class.php");
	$mobile=$_POST['mobile'];
	$password=md5($_POST['pass']);
	$db=new connetMysql;
	$con=$db->getConnect();
	
	$chk_sql="SELECT * FROM user WHERE UserPhone='".$mobile."'&&Password='".$password."'";		
	mysqli_query($con,$chk_sql);
	$num=mysqli_affected_rows($con);
	if($num==0)
	{
		$con->close(); 
		echo "<script>alert('用户名密码不正确');</script>";
		echo "<script>window.location.href='login.html'</script>";
		exit;
	}
	else 
	{
		$_SESSION["mb"]=$mobile;
		$_SESSION["pwd"]=$password;
		setcookie("mb",$mobile,time() + (60*60*24*7),"/"); 
        setcookie("w", $password,time() + (60*60*24*7),"/");
		$con->close(); 
		echo "<script>window.location.href='javascript:history.go(-2);'</script>";
		
		exit;
	}
	
?>